import logging
import threading
from logging.handlers import RotatingFileHandler
import com.gcteamo.coj.tools as tools
import com.gcteamo.coj.database as database

### 设置日志
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter(
    fmt='%(asctime)s - %(name)s - %(levelname)s: - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S')

handler = RotatingFileHandler("logging.log", maxBytes=1024 * 1024, backupCount=3, encoding='utf-8')
handler.setFormatter(formatter)
logger.addHandler(handler)

stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.INFO)
stream_handler.setFormatter(formatter)
logger.addHandler(stream_handler)

COJ_CONFIG_VERSION=1

users=[]
lock_users=threading.Lock()

db=database.Database()